import os
import sys

import django

cur_path = os.path.abspath(__file__)
parent = os.path.dirname
sys.path.append(parent(parent(cur_path)))

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")
django.setup()

if __name__ == "__main__":
    from app.accounts.models import User

    ADMIN_USERNAME = "dairoot"
    ADMIN_PASSWORD = "dairoot"

    user, created = User.objects.get_or_create(username=ADMIN_USERNAME)
    user.set_password(ADMIN_PASSWORD)
    user.is_staff = True
    user.is_active = True
    user.is_superuser = True

    user.save()
    print("Superuser created.")
